# 本文件是celery的运行入口，用于启动celery
from celery import Celery
import os
if not os.getenv('DJANGO_SETTINGS_MODULE'):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'meiduo_mall.settings.dev'
# 创建celery实例,指定别名
celery_app = Celery('meiduo_fenghua')
# 加载配置信息
celery_app.config_from_object('celery_tasks.config')

# 自动将异步任务添加到celery_app
celery_app.autodiscover_tasks(['celery_tasks.sms', 'celery_tasks.email','celery_tasks.html'])